home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tricks of the Mac Game Programming Gurus
/
TricksOfTheMacGameProgrammingGurus.iso
/
More Source
/
Libraries
/
SAT 2.3b4
/
Misc
/
FaceFromPICT.c
next >
Wrap
Text File
|
1995-05-01
|
1KB
|
46 lines
// C translation by Adam Wight
#include "SAT.h"
FacePtr GetFaceFromPICT (int colorPICTid,int bwPICTid,int maskPICTid);
/*No error checking yet!*/
FacePtr GetFaceFromPICT (int colorPICTid,int bwPICTid,int maskPICTid) {
Rect bounds;
PicHandle thePICT, maskPICT;
FacePtr theFace;
SATPort savePort;
SATGetPort(&savePort);
/*Get PICTs*/
if (gSAT.initDepth > 1) thePICT = GetPicture(colorPICTid);
else thePICT = GetPicture(bwPICTid);
maskPICT = GetPicture(maskPICTid);
bounds = (*thePICT)->picFrame;
OffsetRect(&bounds, -bounds.left, -bounds.top); /* Unnecessary? I think NewFace does this for us. /Ingemar */
/*Create face*/
theFace = SATNewFace(&bounds);
/*Draw in the face*/
SATSetPortFace(theFace);
DrawPicture(thePICT, &bounds);
SATSetPortMask(theFace);
DrawPicture(maskPICT, &bounds);
/*Tell SAT that we are done*/
SATChangedFace(theFace);
/*Get rid of the PICTs*/
ReleaseResource((Handle)thePICT);
ReleaseResource((Handle)maskPICT);
/*Return the face.*/
SATSetPort(&savePort);
return theFace;
}